package designpatterns.proxy.demo04;

import designpatterns.proxy.demo02.UserService;
import designpatterns.proxy.demo02.UserServiceImpl;

/**
 * @author 真香
 * @create 2021-06-01 16:48
 */
public class Client {

    public static void main(String[] args){
        // 真实对象
        UserServiceImpl userService = new UserServiceImpl();

        // 代理对象
        ProxyInvocationHandler proxyInvocationHandler = new ProxyInvocationHandler();
        // 设置要代理谁
        proxyInvocationHandler.setTarget(userService);
        // 得到代理工具人
        UserService proxy = (UserService) proxyInvocationHandler.getProxy();
        // 调用真实对象的方法
        proxy.select();

    }

}
